#ifndef CABINETCONFIG_H
#define CABINETCONFIG_H

#include <QObject>
#include <QPoint>
#include <QVariant>
#include "userinfo.h"
#include <QList>
#include <QSettings>
#include <QStringList>

class CabinetConfig : public QObject
{
    Q_OBJECT
public:
    static CabinetConfig* config();
    void configInit();
    QList<UserInfo*> getUsers();
    void addUser(UserInfo* info);

    //sets
    void setScreenPos(QPoint pos);
    void setLayout(int seq, QString lay);
    void setCabinetNum(int num);
    void setCtrlSeq(int col, QByteArray ctrlWd);
    void setCtrlIo(int col, QByteArray ctrlWd);
    void setTexts(int col, QStringList texts);
    void setLockDev(QString devName);
    void setLockBaudrate(int baudrate);
    void setCabinetId(QString cabId);
    void setSpecialCase(int col, int row);
    void setDepartName(QString depName);
    void setDepartId(QString depId);
    void setApiAddress(QString address);
    void setCtrlAddress(QString address);
    void setCurUser(UserInfo* info);
    void setIp(QString ip);
    void setGateway(QString gateway);
    void setMac(QString mac);
    void setNetmask(QString mask);
    void setDevice();

    //gets
    QPoint getScreenPos();
    QStringList getAllLayout();
    QByteArray getCtrlSeq(int col);
    QByteArray getCtrlIo(int col);
    QStringList getTexts(int col);
    QString getLockDev();
    int getLockBaudrate();
    QString getCabinetId();
    QPoint getSpecialCase();
    QString getDepartName();
    QString getDepartId();
    QString getApiAddress();
    QString getCtrlAddress();
    UserInfo* getCurUser();
    QString getIp();
    QString getGateway();
//    QString getMac();
//    QString getNetmask();

    //remove
    void removeCabinet(int seq);
    void removeUser(UserInfo *info);


private:
    explicit CabinetConfig(QObject *parent = NULL);
    static CabinetConfig* c;
    UserInfo* curUser;
    QString appPath;
    QString configPath;
    QString userPath;

    void setConfig(QString key, QVariant value);
    QVariant getConfig(QString key, QVariant defaultRet = QVariant());
    void removeConfig(QString path);


signals:

public slots:

};

#endif // CABINETCONFIG_H
